<div class="comments box">
    <header>
        <h3><i class="icon-comments icon-border-circle"></i> {$info.comment} 条评论</h3>
    </header>
    <section class="comments-list">
        <!-- 模版标签 -->
            <corethink:comment_list name="vo" doc_id="$info['id']">
                <div class="comment">
                    <a href="{:U('User/index/uid/'.$vo['uid'])}" class="avatar">
                        <img src="{$vo.avatar|get_cover='avatar'}" style="width:40px;height:40px;">
                    </a>
                    <div class="content">
                        <div class="pull-right">
                            <span class="text-muted">{$vo.ctime}</span> &nbsp;
                            <strong class="floor">#{$i}</strong>
                        </div>
                        <span class="author">
                            <a href="#"><strong>{$vo.username}</strong></a>
                            <notempty name="vo.pid">
                                <span class="reply">
                                    <span class="text-muted small"> 回复 </span>
                                    <a href="#">{$vo.parentvo_username}</a>
                                </span>
                            </notempty>
                        </span>
                        <div class="text">{$vo.content}</div>
                        <div class="actions small">
                            <a href="javascript:void(0);" class="reply-action" comment_id="{$vo.id}" username="{$vo.username}">回复</a>
                        </div>
                    </div>
                </div>
            </corethink:comment_list>
        <!-- /模版标签 -->
    </section>
    <php>if(C('TOGGLE_USER_COMMENT')):</php>
        <footer>
            <div class="reply-form" id="commentReplyForm">
                <notempty name="__USER__">
                    <a href="#" class="avatar"><i class="icon-user icon-border icon-2x icon-muted"></i></a>
                    <div class="form">
                        <form action="{:U('UserComment/add')}" method="post" class="form comment-form">
                            <div class="form-group">
                                <textarea name="content" class="form-control new-comment-text" rows="3" placeholder="评论是一种态度..."></textarea>
                            </div>
                            <div class="form-group">
                                <input type="hidden" name="pid" value="0">
                                <input type="hidden" name="doc_id" value="{$info.id}">
                                <a id="submit" type="submit" class="btn btn-primary ajax-post block-xs" target-form="comment-form"><i class="icon-comment-alt"></i> 发表评论</a>
                            </div>
                        </form>
                    </div>
                <else />
                    <div class="">
                        <div class="row">
                            <div class="col-xs-12">
                                <a class="btn" href="{:U('User/register')}">注 册</a>
                                <a class="btn btn-info" data-toggle="modal" data-target="#login-modal">登 录</a> &nbsp;
                            </div>
                        </div>
                    </div>
                </notempty>
            </div>
        </footer>
    <php>endif;</php>
</div>

<script type="text/javascript">
    $(function(){
        $('.reply-action').click(function(){
            $('input[name=pid]').val($(this).attr('comment_id'));
            $('.new-comment-text').focus().attr('placeholder', '回复'+$(this).attr('username'));
        });
    });
</script>
